MAXSEQLEN=1024
BUFFERSIZE=1024
DEFINE=
#DEFINE=-D__MAX_KMER_SIZE_31__
CXX=g++
CXXFLAGS=-Wall -std=c++0x -Iinclude -Llib -pthread -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
DEBUG=-ggdb -g -O0 -DDEBUG $(DEFINE)
#OPT=-O2 -DNDEBUG -g $(DEFINE)
OPT=-O3 -DNDEBUG $(DEFINE)
OBJS=main.o Reader.o FastAReader.o FastQReader.o SequenceBuffer.o ContigNode.o\
     KmerHashTable.o KmerNode.o Kmer.o InputOptions.o Node.o Graph.o BlockAllocator.o\
     BarrierUtil.o
EXECUTABLE=ccTSA
#LINK= -pthread -ltcmalloc
LINK= -pthread $(LINK_DEFINE)

SRCS=$(addprefix src/, $(OBJS:.o=.cpp))
DEBUG_OBJS = $(addprefix obj_dbg/, $(OBJS))
RELEASE_OBJS = $(addprefix obj/, $(OBJS))

PWD = $(shell pwd)

all: release

release: releasedir $(RELEASE_OBJS)
	$(CXX) $(LINK) $(RELEASE_OBJS) -o $(EXECUTABLE)
 
debug: debugdir $(DEBUG_OBJS)
	$(CXX) $(LINK) $(DEBUG_OBJS) -o $(EXECUTABLE)

obj_dbg/%.o : src/%.cpp
	$(CXX) $(CXXFLAGS) $(DEBUG) -c $< -o $@
obj/%.o : src/%.cpp
	$(CXX) $(CXXFLAGS) $(OPT) -c $< -o $@
	
releasedir:
	- mkdir -p obj
debugdir:
	- mkdir -p obj_dbg

clean:
	- rm -rf obj obj_dbg $(EXECUTABLE)


